<template>
  <div>
    <van-image-preview
      v-model="show"
      :images="images"
      @change="onChange"
      :start-position="index"
    />

    <van-panel :title="title" desc="发布日期2019-11-14 112次浏览 分类：民生经济">
      <div>
        <van-image
          width="100"
          height="100"
          v-for="(v,k) in images"
          :src="v"
          :key="k"
          @click="imageTouch"
          :index="k"
        />
      </div>
    </van-panel>

    <Enjoycomment/>

  </div>
</template>

<script>
    import { Image,Panel} from 'vant'
    import Enjoycomment from './Enjoycomment'
    export default {
        name: "Enjoydesc",
        data() {
          return {
              title:'我是详情ID为：',
              show:false,
              index:0,
              images:[
                  'https://img.yzcdn.cn/vant/apple-1.jpg',
                  'https://img.yzcdn.cn/vant/apple-2.jpg',
                  'https://img.yzcdn.cn/vant/apple-3.jpg',
              ]
          }
        },
        components:{
            [Image.name]:Image,
            [Panel.name]:Panel,
            Enjoycomment
        },
        mounted() {
            this.title = this.title + this.$router.currentRoute.query.id
        },
        methods:{
            onChange(index){
            },
            imageTouch(e){
                this.index = parseInt(e.target.parentElement.attributes.index.value)
                this.show = true
            }
        }
    }
</script>

<style scoped>

</style>
